/*
 *	Copyright 2011 ja4cli
 *
 *	Licensed under the Apache License, Version 2.0 (the "License");
 *	you may not use this file except in compliance with the License.
 *	You may obtain a copy of the License at
 *
 *		http://www.apache.org/licenses/LICENSE-2.0
 *
 *	Unless required by applicable law or agreed to in writing, software
 *	distributed under the License is distributed on an "AS IS" BASIS,
 *	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *	See the License for the specific language governing permissions and
 *	limitations under the License.
 */
package org.skarby.ja4cli.conversion;

/**
 * Converts a String argument to a type specific one.<p/>
 * 
 * Please take the following items into consideration when implementing:<p/>
 * 
 * The implementing converter may / should:
 * <ul>
 * <li>not hold state.</li>
 * <li>preferably be immutable</li>
 * <li>be somewhat efficient, that is:
 *   <ul>
 * 	   <li>should <b>not</b> create files</li>
 *     <li>should <b>not</b> open socket connections, etc.</li>
 *   </ul>
 * </li>
 * </ul>
 * 
 * @author askarby
 * @param <T> the type of argument to convert to.
 */
public interface ArgumentConverter<T> {

	/**
	 * Converts a String argument to the type specific version, dictated by the type parameter <code>T</code>.
	 * @param argument the argument to convert to the type specific version.
	 * @return the type specific version of the String argument, <code>null</code> if <code>argument</code> is <code>null</code>.
	 * @throws ArgumentConversionException if argument could not be converted. 
	 */
	T convert(String argument) throws ArgumentConversionException;
}
